package com.itboye.ihomebank.login;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.view.View;

import com.itboye.ihomebank.MainActivity;
import com.itboye.ihomebank.R;
import com.itboye.ihomebank.base.BaseOtherActivity;
import com.itboye.ihomebank.base.MyApplcation;
import com.itboye.ihomebank.constants.SPContants;
import com.itboye.ihomebank.util.SPUtils;
/**
 * 日志名  格式   android_用户ID_yyyy-MM-dd
 * 
 * @author young
 *
 */
public class SplashActivity extends BaseOtherActivity {

	Handler handler;

	

	 private String paserTime(long milliseconds) {  
	        System.setProperty("user.timezone", "Asia/Shanghai");  
	        TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");  
	        TimeZone.setDefault(tz);  
	        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");  
	        String times = format.format(new Date(milliseconds));  
	          
	        return times;  
	    }  
	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		handler.sendEmptyMessageDelayed(123, 2500);
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
		handler.removeMessages(123);
		finish();
		
	}
	@Override
	public void finish() {
		// TODO Auto-generated method stub
		super.finish();
//		overridePendingTransition(0, R.anim.anim_falldown);
	}

	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected int layout_id() {
		// TODO Auto-generated method stub
		return R.layout.activity_splash;
	}

	@Override
	protected void onInitController() {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void onInit() {
		// TODO Auto-generated method stub
		handler = new Handler() {
			public void handleMessage(android.os.Message msg) {
//				boolean IS_LOGINED = (Boolean) SPUtils.get(App.ctx, null, SPContants.IS_LOGINED, false);
//				if (IS_LOGINED) {
//					LoginController.setLoginState(new LoginedState());
//				} else {
//					LoginController.setLoginState(new UnLoginState());
//				}
//				if(SPUtils.get(MyApplcation.ctx, null, SPContants.LANGUAGE, "").equals("")){
//					SPUtils.put(MyApplcation.ctx, null, SPContants.LANGUAGE, "chinese");
//					SPUtils.put(MyApplcation.ctx, null, SPContants.ENGLISH, "english");
//				}
//				if(SPUtils.get(App.ctx, null, SPContants.LANGUAGE, "").equals("chinese"))//中文
					startActivity(new Intent(getApplicationContext(), MainActivity.class));
//				else//English
//					startActivity(new Intent(getApplicationContext(), MainHomeEnglishActivity.class));
			};
		};
	}

	@Override
	protected void onReadIntent(Bundle bundle) {
		// TODO Auto-generated method stub
		
	}
}
